package com.soulkun.smarthome.ui.splash.family

import android.os.Bundle
import android.view.View
import androidx.navigation.fragment.findNavController
import com.soulkun.smarthome.ui.main.AppMainActivity
import com.soulkun.smarthome.R
import com.soulkun.smarthome.databinding.AppFragmentSplashFamilyBinding
import com.soulkun.smarthome.logic.enum.NavigationEnum
import soulkun.library.mvvm.component.BaseDataBindingFragment
import soulkun.library.utils.navigateSafe

class AppSplashFamilyFragment : BaseDataBindingFragment<AppFragmentSplashFamilyBinding>() {

    override fun setLayout(): Int {
        return R.layout.app_fragment_splash_family
    }

    override fun initView() {

    }

    override fun initData() {
        requireDataBinding().onClickListener = View.OnClickListener {
            when (it.id) {
                R.id.tv_splash_family_text_ignore -> {
                    AppMainActivity.startIntentAnimationSlideVertical(mActivity)
                    mActivity.finish()
                }
                R.id.btn_splash_family_family_create -> {
                    findNavController().navigateSafe(
                        R.id.action_appSplashFamilyFragment_to_app_navigation_family_create,
                        R.id.appSplashFamilyFragment,
                        Bundle().apply {
                            putSerializable("navigationType", NavigationEnum.Splash)
                        })
                }
                R.id.btn_splash_family_family_join -> {
                    findNavController().navigateSafe(
                        R.id.action_appSplashFamilyFragment_to_appMainPersonalFamilyJoinFragment,
                        R.id.appSplashFamilyFragment,
                        Bundle().apply {
                            putSerializable("navigationType", NavigationEnum.Splash)
                        })
                }
                R.id.iv_splash_family_icon_cancel -> {
                    findNavController().navigateUp()
                }
            }
        }
    }

    override fun initListener() {
    }

    override fun doOnCreate() {
    }
}